#include "integermap.h"
// #include "nolock.h"
// #include "jobqueue.h"

int main() {
  uint64 reps = (1ull << 5) - 1;
  int64 sum =0;
  IntegerMap<int64> m;
  //hash_map<uint64, uint64, SimpleHash<uint64> > m;
  // NLHash<uint64> m(25);
  for (uint64 i=0; i<reps; i++) {
    //uint64 k = (i * 2420523951) & (range-1);
    //int64 v = i; // (k * k) % range;
    int64 k = i;
    int64 v = 3*i;
    sum += v;
    // m.InsertReplace(k, i);
    m[k] = v;
    // uint64 * l = m.InsertOrReturn(k);
    // *l = i;
  }
  
  cout << "added once sum:" << sum << endl;
  for (int i=0; i<100; i += 10) {
    cout << "erasing " << i << endl;
    m.erase(i);
  }
  int64 sum2 =0;
  for (IntegerMap<int64>::iterator run = m.r_begin(); 
       run != m.r_end(); --run) {
    cout << run.Key() << " " << run.Value() << endl;
    sum2 += run.Value();
    //cout << run.Key() << " " << 
    //  run.Value().first << " " << run.Value().second << endl;
  }
  cout << "sum after deletion:" << sum2 << endl;
  cout << "diff:" << sum - sum2 << endl;
  // cout << "map size " << m.size() << endl;
  
  cout << " done " << endl;
  return 0;
  

}
